package com.ymatou.iapi.livebuyer.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.livebuyer.parameter.GetConfigBean;
import com.ymatou.iapi.livebuyer.service.GetConfigCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.LiveRoomCallService;
/**
*获取配置信息
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_GetConfig{
	private static GetConfigBean getconfigBean;
	private static GetConfigCall getconfigCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取配置信息");
	}

	@Before
	public void caseUp() {
		getconfigBean=new GetConfigBean();
		getconfigCall=new GetConfigCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getconfigCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_GetConfig_001() {
		Logger.start(true,"获取配置信息成功");
		try {
			getconfigBean.setAppId("autotest");
			getconfigCall.setData(getconfigBean);
			getconfigCall.callService();	
			Logger.verifyEquals("200", getconfigCall.getString("code"), "验证code");
			JsonObject data = getconfigCall.getJsonObject().get("data").getAsJsonObject();
			Logger.verifyEquals(LiveRoomCallService.AppId, data.get("liveAppId").getAsString() ,"验证liveAppId");
			Logger.verifyEquals(LiveRoomCallService.BizId, data.get("liveBizId").getAsString() ,"验证liveBizId");
			Logger.verifyEquals(LiveRoomCallService.ImAccountType, data.get("imAccountType").getAsString() ,"验证ImAccountType");
			Logger.verifyEquals(LiveRoomCallService.ImSdkAppId, data.get("imSdkAppId").getAsString() ,"验证ImSdkAppId");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}